using MediatR;
using Microsoft.AspNetCore.Http;
using ThreeTeams.Domain.ThreeTeams.Domain.Entities;
using WMS.Common;

namespace WMS.Api.Application.Commands
{
    /// <summary>
    /// 获取产品列表命令
    /// </summary>
    public class GetProductListCommand : IRequest<ApiResult<PagingResult<List<ProductDto>>>>
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; } = 10;

        /// <summary>
        /// 产品名称
        /// </summary>
        public string? ProductName { get; set; }

        /// <summary>
        /// SKU编码
        /// </summary>
        public string? SKU { get; set; }

        /// <summary>
        /// 产品类型ID
        /// </summary>
        public int? ProductTypeId { get; set; }
    }

    /// <summary>
    /// 获取产品详情命令
    /// </summary>
    public class GetProductByIdCommand : IRequest<ApiResult<ProductDto>>
    {
        /// <summary>
        /// 产品ID
        /// </summary>
        public int Id { get; set; }
    }

    /// <summary>
    /// 创建产品命令
    /// </summary>
    public class CreateProductCommand : IRequest<ApiResult<int>>
    {
        /// <summary>
        /// 产品DTO
        /// </summary>
        public ProductDto Product { get; set; }
    }

    /// <summary>
    /// 更新产品命令
    /// </summary>
    public class UpdateProductCommand : IRequest<ApiResult<int>>
    {
        /// <summary>
        /// 产品DTO
        /// </summary>
        public ProductDto Product { get; set; }
    }

    /// <summary>
    /// 删除产品命令
    /// </summary>
    public class DeleteProductCommand : IRequest<ApiResult<int>>
    {
        /// <summary>
        /// 产品ID
        /// </summary>
        public int Id { get; set; }
    }

    /// <summary>
    /// 批量删除产品命令
    /// </summary>
    public class BatchDeleteProductCommand : IRequest<ApiResult<int>>
    {
        /// <summary>
        /// 产品ID列表
        /// </summary>
        public List<int> Ids { get; set; }
    }

    /// <summary>
    /// 导入产品命令
    /// </summary>
    public class ImportProductCommand : IRequest<ApiResult<ImportResult>>
    {
        /// <summary>
        /// Excel文件
        /// </summary>
        public IFormFile File { get; set; }
    }

    /// <summary>
    /// 导出产品命令
    /// </summary>
    public class ExportProductCommand : IRequest<ApiResult<byte[]>>
    {
        /// <summary>
        /// 产品名称
        /// </summary>
        public string? ProductName { get; set; }

        /// <summary>
        /// SKU编码
        /// </summary>
        public string? SKU { get; set; }

        /// <summary>
        /// 产品类型ID
        /// </summary>
        public int? ProductTypeId { get; set; }
    }

    /// <summary>
    /// 产品DTO
    /// </summary>
    public class ProductDto
    {
        /// <summary>
        /// 产品ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 团队ID
        /// </summary>
        public int TeamId { get; set; }

        /// <summary>
        /// 类别ID
        /// </summary>
        public int CategoryId { get; set; }

        /// <summary>
        /// 产品类型ID
        /// </summary>
        public int ProductTypeId { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string ProductName { get; set; }

        /// <summary>
        /// SKU编码
        /// </summary>
        public string SKU { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string? Specification { get; set; }

        /// <summary>
        /// 入库价格(分)
        /// </summary>
        public long PurchasePrice { get; set; }

        /// <summary>
        /// 出库价格(分)
        /// </summary>
        public long SellingPrice { get; set; }

        /// <summary>
        /// 库存预警数量
        /// </summary>
        public int StockAlert { get; set; }

        /// <summary>
        /// 重量(克)
        /// </summary>
        public int Weight { get; set; }

        /// <summary>
        /// 品牌
        /// </summary>
        public string? Brand { get; set; }

        /// <summary>
        /// 型号
        /// </summary>
        public string? Model { get; set; }

        /// <summary>
        /// 英文名称
        /// </summary>
        public string? EnglishName { get; set; }

        /// <summary>
        /// 海关编码
        /// </summary>
        public string? CustomsCode { get; set; }

        /// <summary>
        /// 申报价格(分)
        /// </summary>
        public long DeclaredPrice { get; set; }

        /// <summary>
        /// 长度(毫米)
        /// </summary>
        public int Length { get; set; }

        /// <summary>
        /// 宽度(毫米)
        /// </summary>
        public int Width { get; set; }

        /// <summary>
        /// 高度(毫米)
        /// </summary>
        public int Height { get; set; }

        /// <summary>
        /// 状态 1-启用 0-禁用
        /// </summary>
        public int Status { get; set; } = 1;

        /// <summary>
        /// 备注
        /// </summary>
        public string? Notes { get; set; }

        /// <summary>
        /// 图片
        /// </summary>
        public string Photo { get; set; } = string.Empty;
    }

    /// <summary>
    /// 导入结果
    /// </summary>
    public class ImportResult
    {
        /// <summary>
        /// 成功数量
        /// </summary>
        public int SuccessCount { get; set; }

        /// <summary>
        /// 失败数量
        /// </summary>
        public int FailCount { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public List<string> ErrorMessages { get; set; } = new List<string>();
    }
} 